<?php
	$order_number = strip_tags($_GET['order_number']);
	$sql_search = $order_number ? "AND  `o`.`order_id` = '$order_number'" : '';
	 
	list($sql,$all_page) = splitPage("`tbl_buy_order` AS `o` LEFT JOIN `tbl_member` AS `m` ON `o`.`member_id` = `m`.`member_id`","1 $sql_search AND `o`.`status` != '2' ORDER BY `o`.`date` DESC", 30, $_GET['p'],"`o`.* , `m`.`first_name` , `m`.`last_name` , `m`.`email`");
	$strPage = fetchPage($all_page,$_GET['p']);
	$query = mysql_query($sql);
	$tp->block('result');
	while($result = mysql_fetch_assoc($query)) {
		$order_id	= $result['order_id'];
		$name		= $result['first_name'].' '.$result['last_name'];
		$email		= $result['email'];
		$ems_id		= $result['ems_id'];
	 	$status		= $result['status'];
		$date		= formatDate($result['date'], 'd/m/Y');
		 
		 if($status == '3'){
			$disclass	= "<a href=\"uncomplete/$order_id\" class=\"complete tooltip\">Complete<em>Complete</em></a>";
			$status		= '<span style="color:#390">Complete</span>';
		}else if($status == '1'){
			$disclass	= "<a href=\"complete/$order_id\" class=\"send tooltip\">Send<em>Send</em></a>";
			$status		= '<span style="color:#F30">dilivery</span>';
		}else{
			$disclass	= '';
			$status		= '<span style="color:#999">padding</span>';
		}
		
		$tp->apply();
	}
	mysql_free_result($query);
?>